package com.leng.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author leng
 * @since 2022-08-21
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("tb_user")
@ToString
public class User extends Model<User> {

    @ApiModelProperty(value = "用户ID")
    @ExcelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "用户名")
    @ExcelProperty(value = "username")
    private String username;

    @ApiModelProperty(value = "昵称")
    @ExcelProperty(value = "nickname")
    private String nickname;

    @ApiModelProperty(value = "邮箱")
    @ExcelProperty(value = "email")
    private String email;

    @ApiModelProperty(value = "头像")
    @ExcelProperty(value = "avatar")
    private String avatar;

    @ApiModelProperty(value = "联系电话")
    @ExcelProperty(value = "联系电话")
    private String phoneNumber;

    @ApiModelProperty(value = "状态 0锁定 1有效")
    @ExcelProperty(value = "status")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    @ExcelProperty(value = "createTime")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @ExcelProperty(value = "modifiedTime")
    private Date modifiedTime;

    @ApiModelProperty(value = "性别 0男 1女 2保密")
    @ExcelProperty(value = "sex")
    private Integer sex;

    @ApiModelProperty(value = "盐")
    @ExcelProperty(value = "salt")
    private String salt;

    @ApiModelProperty(value = "0:超级管理员，1：系统用户")
    @ExcelProperty(value = "type")
    private Integer type;

    @ApiModelProperty(value = "密码")
    @ExcelProperty(value = "password")
    private String password;

    @ApiModelProperty(value = "生日")
    @ExcelProperty(value = "birth")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date birth;

    @ApiModelProperty(value = "部门id")
    @ExcelProperty(value = "departmentId")
    private Long departmentId;

    @ApiModelProperty(value = "逻辑删除")
    @ExcelProperty(value = "deleted")
    private Boolean deleted;

    /**
     * 部门名称
     */
    @ExcelProperty("部门名称")
    @TableField(exist = false)
    private String departmentName;

    @Override
    public Serializable pkVal() {
        return this.id;
    }

}
